package com.chinasofti.mydate.myjdk8datetime;

import java.text.ParseException;
import java.time.DayOfWeek;
import java.time.LocalDateTime;

public class JKD8DateDemo3 {
    public static void main(String[] args) throws ParseException {
        LocalDateTime localDateTime =LocalDateTime.of(2023,04,04,11,20,04);
        //获取年
        int year=localDateTime.getYear();
        System.out.println("year="+year);
        //获取月
        int month = localDateTime.getMonthValue();
        System.out.println("month="+month);
        //获取天
        int day = localDateTime.getDayOfMonth();
        System.out.println("月中的day="+day);

        int dayYear = localDateTime.getDayOfYear();
        System.out.println("年中的day="+dayYear);

        //获取星期
        DayOfWeek dayOfWeek = localDateTime.getDayOfWeek();
        System.out.println("dayWeek="+dayOfWeek);

        //获取分钟
            int minute = localDateTime.getMinute();
        System.out.println("minute="+minute);
        //获取小时
        int hour = localDateTime.getHour();
        System.out.println("hour="+hour);
    }
}